package com.tech.koufu.action;

import java.util.ArrayList;

import android.text.TextUtils;

import com.tech.koufu.model.StockInfo;

/**
 * 
 * @ClassName: StockJson
 * @Description: TODO(解析字符串)   
 * @author 123
 * @date 2015年4月19日 下午10:32:52
 */
public class StockJson {
	/**
	 * 0:000006,深振业Ａ,10000,10.02|000007,零七股份,10000,20.81|000009,中国宝安,10000,18.128|
	 */
	public static ArrayList<StockInfo> retSimpStocks(String response){
		ArrayList<StockInfo> datas = new ArrayList<StockInfo>();
		if(!TextUtils.isEmpty(response)){
			String[] rs = response.split(":");
			if(rs[0].equals("0")){
				String[] dds = rs[1].split("\\|");
				for(String st:dds){
					StockInfo si = new StockInfo();
					String[] stocks = st.split(",");
					si.setCode(stocks[0]);
					si.setName(stocks[1]);
					si.setBj1(stocks[2]);
					si.setSj1(stocks[3]);
					datas.add(si);
				}
			}
		}
		return datas;
	}
}
